home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / modelers / geomview / source.lha / Geomview / src / lib / oogl / wa / fsaparse.l < prev    next >
Encoding:
Lex Description  |  1993-04-08  |  1.4 KB  |  71 lines

  1. %{
  2.  
  3. /*
  4.  * fsaparse.l (lex.yy.c)
  5.  *
  6.  * Lex definitions for lexical scanner for parsing word-acceptor
  7.  * automata.  See fsaparse.y for more info.
  8.  *
  9.  * mbp Sat Mar 23 21:58:12 1991
  10.  * mbp@thales.urich.edu
  11.  */
  12.  
  13. #include <stdio.h>
  14. #include <math.h>
  15. #include "yystype.h"
  16. #include "y.tab.h"
  17.  
  18. YYSTYPE yylval;
  19.  
  20. /* disable output of unmatched input */
  21. #undef output
  22. #define output(c) 
  23.  
  24. %}
  25.  
  26. DIGIT    [0-9]
  27. WS    [ \t\n,]
  28. LETTER    [A-Za-z]
  29. SIGN    [+-]
  30.  
  31. %% /* RULES SECTION */
  32.  
  33. {WS}+            ;
  34.  
  35. "Format"    { return(FORMAT);    }
  36. "format"    { return(FORMAT);    }
  37. "fsa"        { return(FSA);        }
  38. "states"    { return(STATES);    }
  39. "symbols"    { return(SYMBOLS);    }
  40. "bfs"        { return(BFS);        }
  41. "min"        { return(MIN);        }
  42. "variables"    { return(VARIABLES);    }
  43. "alphabet"    { return(ALPHABET);    }
  44. "start"        { return(START);    }
  45. "atable"    { return(ATABLE);    }
  46. "inverses"    { return(INVERSES);    }
  47. "inv"        { return(INV);        }
  48. "bfs"        { return(BFS);        }
  49. "min"        { return(MIN);        }
  50.  
  51. "{"        { return(LEFT_BRACE);    }
  52. "}"        { return(RIGHT_BRACE);    }
  53. "("        { return(LEFT_PAREN);    }
  54. ")"        { return(RIGHT_PAREN);    }
  55. ";"        { return(SEMICOLON);    }
  56. "%"        { return(PERCENT);    }
  57. "="        { return(EQUAL);    }
  58.  
  59. {SIGN}?{DIGIT}+            { yylval.i = atoi(yytext); return(INT);  }
  60. {SIGN}?{DIGIT}*\.{DIGIT}?    { yylval.d = atof(yytext); return(REAL); }
  61. {SIGN}?{DIGIT}+\.{DIGIT}*    { yylval.d = atof(yytext); return(REAL); }
  62.  
  63. [^ \t\n{};%()=]+        { strcpy(yylval.s, yytext); return(STRING); }
  64.  
  65. %%  /* SUBPROGRAMS SECTION */
  66.  
  67. yywrap()
  68. {
  69.   return(1);
  70. }
  71.